package com.situ.ssm.controller;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.situ.ssm.entity.User;

@Controller
@RequestMapping("/user")
public class UserController {

	@RequestMapping("/login")
	public String login(User user, HttpSession session) {
		System.out.println("UserController.login()");
		if ("zhangsan".equals(user.getName()) && "123".equals(user.getPassword())) {
			session.setAttribute("user", user);
			return "redirect:/index.action";
		} 
		
		return "redirect:/login.jsp";
	}
}
